#ifndef _MATH_INCLUDED_
#define _MATH_INCLUDED_

/**
 * abs()
 * vrati absolutni cislo vstupu
 */
int abs(int i) {
  if(i < 0)
    return (-i);
   else
    return i;
}

/**
 * rand()
 * vygeneruje nahodne cislo
 */
unsigned int rand(void) {
  static unsigned int nr = 0x1D7A;
  asm xor ah, ah;
  asm int 0x1a;
  nr = nr + abs(
    (_DX * _CX) + (_DX + _CX * (_CX - _DX)) ^ (_BX + _CX ^ _DX + _DX * (_CX * _DX)) ^
    (_DX * _CX) - (_DX + _CX * (_CX - _DX)) ^ (_BX - _CX ^ _DX + _DX * (_CX * _DX))
  );
  return nr;
}
#endif
